//
//  CZEmoticonButton.swift
//  weiBo
//
//  Created by apple on 16/5/22.
//  Copyright © 2016年 itcast. All rights reserved.
//

import UIKit

class CZEmoticonButton: UIButton {

    var emotion: CZEmoticon? {
        didSet{
            guard let etc = emotion else {
            
                return
            }
            
            if etc.type == "0" {
                self.setImage(UIImage(named: etc.path!), forState: .Normal)
                self.setTitle(nil, forState: .Normal)
            }else {
                self.setImage(nil, forState: .Normal)
                self.setTitle((etc.code! as NSString).emoji(), forState: .Normal)
            }
            
        
        }
    
    
    }
    
    
}
